package com.hghivln.controller.system;

import com.hghivln.pojo.dto.LoginInfoDto;
import com.hghivln.pojo.vo.AjaxResult;
import com.hghivln.service.LoginInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotEmpty;

@RestController
@RequestMapping("system/loginInfo")
public class LoginInfoController {

    @Autowired
    private LoginInfoService loginInfoService;

    /**
     * 分页查询
     */
    @GetMapping("listForPage")
    public AjaxResult listForPage(LoginInfoDto loginInfoDto) {
        return loginInfoService.listForPage(loginInfoDto);
    }

    /**
     * 删除
     */
    @DeleteMapping("deleteLoginInfoByIds/{ids}")
    public AjaxResult deleteLoginInfoByIds(@PathVariable @Validated @NotEmpty(message = "日志ID不能为空") Long[] ids) {
        return AjaxResult.success(loginInfoService.deleteLoginInfoByIds(ids));
    }

    /**
     * 全部清空
     */
    @DeleteMapping("clearLoginInfo")
    public AjaxResult clearLoginInfo() {
        return AjaxResult.success(loginInfoService.clearLoginInfo());
    }
}
